package main
import (
	"fmt"
)

// 12. 可变参数函数 可变参数函数是一种参数个数可变的函数。
func main(){
	nums := []int{89, 90, 95}
    find(89, nums...)

	names := []string{"name","xiao", "hao"}
	fmt.Println("处理前：",names)
	change(names...)
	fmt.Println("处理后：",names)

}

func find(num int, nums ...int) {
    fmt.Printf("type of nums is %T\n", nums)
    found := false
    for i, v := range nums {
        if v == num {
            fmt.Println(num, "found at index", i, "in", nums)
            found = true
        }
    }
    if !found {
        fmt.Println(num, "not found in ", nums)
    }
    fmt.Printf("\n")
}

func change(s ...string) {
	s[0] = "yang"
	s = append(s, "is myName")
	fmt.Println("change方法里面", s)
}